package leecode

func hammingWeightCR(num uint32) int {
	// n & (n -1) 把二进制数的右边最后一位的1变为0
	count := 0
	for num > 0 {
		num = num & (num - 1)
		count++
	}
	return count
}
